<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-bind</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<h1>v-bind作用:设置元素的属性或样式</h1>
<div id="app">
    <h2><a v-bind:class="{active:isActive}" :href="url" :title="title">BaiDu</a></h2>
    <button @click="isActive=!isActive">切换</button>
    <button onclick="console.log(document.getElementsByClassName('active').length)">按钮</button>
    <p :style="styleFunOne">行内样式绑定</p>
    <p :style="[styleFunOne,styleFunTwo]">数组行内样式绑定</p>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            url: 'https://www.baidu.com',
            title: '百度',
            isActive: true,
            styleFunOne: {
                fontSize: '58px',
                color: 'blue',
                fontWeight: 'bold'
            },
            styleFunTwo: {
                backgroundColor: 'lightgray',
                padding: '10px'
            }
        }
    })
</script>
</body>
</html>